<%@ page import="com.erpanderp.pr.model.entity.PurchaseRequest" %>



<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'purchaseRequestCode', 'error')} ">
	<label for="purchaseRequestCode">
		<g:message code="purchaseRequest.purchaseRequestCode.label" default="Purchase Request Code" />
		
	</label>
	<g:textField name="purchaseRequestCode" maxlength="50" value="${purchaseRequestInstance?.purchaseRequestCode}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'sapPrNumber', 'error')} ">
	<label for="sapPrNumber">
		<g:message code="purchaseRequest.sapPrNumber.label" default="Sap Pr Number" />
		
	</label>
	<g:textArea name="sapPrNumber" cols="40" rows="5" maxlength="255" value="${purchaseRequestInstance?.sapPrNumber}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'documentType', 'error')} ">
	<label for="documentType">
		<g:message code="purchaseRequest.documentType.label" default="Document Type" />
		
	</label>
	<g:textField name="documentType" maxlength="4" value="${purchaseRequestInstance?.documentType}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'description', 'error')} ">
	<label for="description">
		<g:message code="purchaseRequest.description.label" default="Description" />
		
	</label>
	<g:textArea name="description" cols="40" rows="5" maxlength="1024" value="${purchaseRequestInstance?.description}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'createdBy', 'error')} ">
	<label for="createdBy">
		<g:message code="purchaseRequest.createdBy.label" default="Created By" />
		
	</label>
	<g:textArea name="createdBy" cols="40" rows="5" maxlength="255" value="${purchaseRequestInstance?.createdBy}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'lastUpdatedBy', 'error')} ">
	<label for="lastUpdatedBy">
		<g:message code="purchaseRequest.lastUpdatedBy.label" default="Last Updated By" />
		
	</label>
	<g:textArea name="lastUpdatedBy" cols="40" rows="5" maxlength="255" value="${purchaseRequestInstance?.lastUpdatedBy}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'status', 'error')} ">
	<label for="status">
		<g:message code="purchaseRequest.status.label" default="Status" />
		
	</label>
	<g:select name="status" from="${purchaseRequestInstance.constraints.status.inList}" value="${purchaseRequestInstance?.status}" valueMessagePrefix="purchaseRequest.status" noSelection="['': '']"/>
</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'purchaseRequestItems', 'error')} ">
	<label for="purchaseRequestItems">
		<g:message code="purchaseRequest.purchaseRequestItems.label" default="Purchase Request Items" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${purchaseRequestInstance?.purchaseRequestItems?}" var="p">
    <li><g:link controller="purchaseRequestItem" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="purchaseRequestItem" action="create" params="['purchaseRequest.id': purchaseRequestInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'purchaseRequestItem.label', default: 'PurchaseRequestItem')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'purchaseRequestTransactionViews', 'error')} ">
	<label for="purchaseRequestTransactionViews">
		<g:message code="purchaseRequest.purchaseRequestTransactionViews.label" default="Purchase Request Transaction Views" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${purchaseRequestInstance?.purchaseRequestTransactionViews?}" var="p">
    <li><g:link controller="purchaseRequestTransactionView" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="purchaseRequestTransactionView" action="create" params="['purchaseRequest.id': purchaseRequestInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'purchaseRequestTransactionView.label', default: 'PurchaseRequestTransactionView')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'schedules', 'error')} ">
	<label for="schedules">
		<g:message code="purchaseRequest.schedules.label" default="Schedules" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${purchaseRequestInstance?.schedules?}" var="s">
    <li><g:link controller="schedule" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="schedule" action="create" params="['purchaseRequest.id': purchaseRequestInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'schedule.label', default: 'Schedule')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: purchaseRequestInstance, field: 'user', 'error')} required">
	<label for="user">
		<g:message code="purchaseRequest.user.label" default="User" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="user" name="user.id" from="${com.erpanderp.pr.model.entity.User.list()}" optionKey="id" required="" value="${purchaseRequestInstance?.user?.id}" class="many-to-one"/>
</div>

